package com.aaa.javaweb.dao.impl;

import com.aaa.javaweb.dao.GreXinXiDao;
import com.aaa.javaweb.until.JDBCUntil;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public class GreXinXiDaoImpl implements GreXinXiDao {
    @Override
    public List<Map> selectxinxi(String kid, Integer page, Integer limit) {
        String sql="select * from t_order LEFT JOIN t_type on t_order.roomtype=t_type.id where uid=? ORDER BY `status` asc limit ?,?";
        return JDBCUntil.selectMap(sql,kid,(page-1)*limit,limit);
    }

    @Override
    public int updquxiao(String id) {
        String sql="update  t_order set status=10 where id=?";
        return JDBCUntil.Updateout(sql,id);
    }

    @Override
    public int selectcount() {
        String sql="select count(*) a from t_order";
        List<Map> maps = JDBCUntil.selectMap(sql);
        int a = Integer.parseInt(maps.get(0).get("a")+"");
        return a;
    }

    /*@Override
    public List<Map> selectxinxis(String kid) {
        String sql="select * from t_order where uid=? and status!=0";
        return JDBCUntil.selectMap(sql,kid);
    }*/
}
